﻿using System;

namespace Validity.Rules.Decorators
{
  public class RuleDecorator<TObject, TValue>
    : IRule<TObject, TValue>
  {
    private readonly IRule<TObject, TValue> _rule;

    public RuleDecorator(IRule<TObject, TValue> rule)
    {
      Verify.NotNull(rule);

      _rule = rule;
    }

    public virtual Boolean IsViolatedBy(TObject obj, TValue value)
    {
      return _rule.IsViolatedBy(obj, value);
    }

    public virtual RuleViolation GetRuleViolation(TObject obj, TValue value)
    {
      return _rule.GetRuleViolation(obj, value);
    }
  }
}
